<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterVulsChangeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasColumn('vuls', 'vuls_number')){

            Schema::table('vuls', function ($table) {
                $table->string('vuls_number',20)->after('id')->default('')->comment('漏洞编号')->change();
            });
        }else{
            Schema::table('vuls', function (Blueprint $table) {
                $table->string('vuls_number',20)->after('id')->default('')->comment('漏洞编号');
            });
        }

    }

    /**
     * 回滚删除
     *
     * @return void
     */
    public function down()
    {
        if (Schema::hasColumn('vuls', 'vuls_number')){
            Schema::table('vuls', function (Blueprint $table) {
                $table->dropColumn('vuls_number');
            });
        }
    }
}
